package com.weng.cloud.service8883.hystrix;

import com.cloud.api.hystrix.HystrixService;
import com.cloud.api.hystrix.NbaPlayer;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: weng
 * @Date: 2022/3/11
 * @Description: com.weng.cloud.service8883.hystrix
 */
@RestController
public class DependencyController implements HystrixService {
    @Override
    public NbaPlayer testDependency(String arg) {
        System.err.println("法师控制强");
        NbaPlayer result = new NbaPlayer();
        result.setNo(7);
        result.setName("kd");
        result.setArg(arg);
        return result;
    }

    @Override
    public String testHystrixFeign() {
        System.err.println("队友的事情帮他做");
        String result = "被爸爸妈妈扔进垃圾桶里面";
        try {
            Thread.sleep(400);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return result;
    }


/*    @PostMapping("/testDependency/{arg}")
    public NbaPlayer testDependency(@PathVariable String arg){
        System.err.println("烈火刀刀爆");
        NbaPlayer result = new NbaPlayer();
        result.setNo(7);
        result.setName("kd");
        result.setArg(arg);
        return result;
    }*/
}
